import 'package:color_dart/RgbaColor.dart';
import 'package:flutter/material.dart';
import 'package:im_flutter_sdk_example/components/a_button/index.dart';
import 'package:im_flutter_sdk_example/utils/global.dart';

class ServeSure extends StatefulWidget {
  ServeSure({Key key}) : super(key: key);

  @override
  _ServeSureState createState() => _ServeSureState();
}

var _checkValue = 1;

class _ServeSureState extends State<ServeSure> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('确认订单')),
      body: SafeArea(
        child: Container(
          height: G.screenHeight(),
          child: Stack(
            children: [
              Positioned(
                child: SingleChildScrollView(
                  child: Container(
                    color: rgba(249, 249, 249, 1),
                    child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Container(
                            margin: EdgeInsets.only(bottom: 10),
                            padding: EdgeInsets.fromLTRB(20, 20, 28, 23),
                            decoration: BoxDecoration(
                              color: rgba(255, 255, 255, 1),
                              border: Border(
                                top: BorderSide(
                                  width: 1, //宽度
                                  color: rgba(221, 221, 221, 1), //边框颜色
                                ),
                              ),
                            ),
                            child: Column(
                              mainAxisAlignment: MainAxisAlignment.start,
                              crossAxisAlignment: CrossAxisAlignment.start,
                              children: [
                                Padding(
                                  padding: EdgeInsets.only(bottom: 15),
                                  child: Text(
                                    '数度智慧AI医疗影像标注',
                                    style: TextStyle(
                                        color: rgba(68, 68, 68, 1),
                                        fontSize: 18),
                                  ),
                                ),
                                Row(
                                  children: [
                                    SizedBox(
                                      width: 95,
                                      height: 68,
                                      child: Image.network(
                                        'https://www.oss.innovationgloble.com/dev/activity/2020-06-10/9323173ed666465fa422e0b52ae75e88.jpg',
                                        fit: BoxFit.cover,
                                      ),
                                    ),
                                    Padding(
                                      padding: const EdgeInsets.only(left: 10),
                                      child: Container(
                                        height: 68,
                                        child: Column(
                                          mainAxisAlignment:
                                              MainAxisAlignment.spaceAround,
                                          crossAxisAlignment:
                                              CrossAxisAlignment.start,
                                          children: [
                                            Row(
                                              children: [
                                                Text(
                                                  '服务地区：',
                                                  style: TextStyle(
                                                      color: rgba(
                                                          136, 135, 135, 1),
                                                      fontSize: 14),
                                                ),
                                                Text(
                                                  '企业活动',
                                                  style: TextStyle(
                                                      color: rgba(
                                                          136, 135, 135, 1),
                                                      fontSize: 14),
                                                ),
                                              ],
                                            ),
                                            Row(
                                              children: [
                                                Text(
                                                  '发布时间：',
                                                  style: TextStyle(
                                                      color: rgba(
                                                          136, 135, 135, 1),
                                                      fontSize: 14),
                                                ),
                                                Text(
                                                  '2020-04-10 12:00:00',
                                                  style: TextStyle(
                                                      color: rgba(
                                                          136, 135, 135, 1),
                                                      fontSize: 14),
                                                ),
                                              ],
                                            ),
                                            Row(
                                              children: [
                                                Text(
                                                  '购买费用：',
                                                  style: TextStyle(
                                                      color: rgba(
                                                          136, 135, 135, 1),
                                                      fontSize: 14),
                                                ),
                                                Text(
                                                  '¥599.00',
                                                  style: TextStyle(
                                                      color: rgba(
                                                          136, 135, 135, 1),
                                                      fontSize: 14),
                                                ),
                                              ],
                                            ),
                                          ],
                                        ),
                                      ),
                                    )
                                  ],
                                )
                              ],
                            ),
                          ),
                          Container(
                            padding: EdgeInsets.symmetric(horizontal: 20),
                            color: rgba(255, 255, 255, 1),
                            child: Column(
                              mainAxisAlignment: MainAxisAlignment.spaceAround,
                              crossAxisAlignment: CrossAxisAlignment.start,
                              children: [
                                Container(
                                  padding:
                                      const EdgeInsets.fromLTRB(0, 16, 0, 16),
                                  decoration: BoxDecoration(
                                      border: Border(
                                          bottom: BorderSide(
                                              width: 1,
                                              color: rgba(235, 235, 235, 1)))),
                                  child: Row(
                                    children: [
                                      Text(
                                        '支付方式',
                                        style: TextStyle(
                                          color: rgba(68, 68, 68, 1),
                                          fontSize: 15,
                                        ),
                                      ),
                                    ],
                                  ),
                                ),
                                Container(
                                  height: 57,
                                  decoration: BoxDecoration(
                                      border: Border(
                                          bottom: BorderSide(
                                              width: 1,
                                              color: rgba(235, 235, 235, 1)))),
                                  child: Row(
                                    mainAxisAlignment:
                                        MainAxisAlignment.spaceBetween,
                                    crossAxisAlignment:
                                        CrossAxisAlignment.center,
                                    children: [
                                      Container(
                                        child: Row(
                                          children: [
                                            SizedBox(
                                              width: 24,
                                              height: 24,
                                              child: Image.asset(
                                                'lib/assets/images/wx_square.png',
                                                fit: BoxFit.cover,
                                              ),
                                            ),
                                            Padding(
                                              padding:
                                                  EdgeInsets.only(left: 11),
                                              child: Text(
                                                '微信支付',
                                                style: TextStyle(
                                                  color: rgba(68, 68, 68, 1),
                                                  fontSize: 15,
                                                ),
                                              ),
                                            ),
                                          ],
                                        ),
                                      ),
                                      _checkValue == 1
                                          ? SizedBox(
                                              width: 20,
                                              height: 20,
                                              child: Image.asset(
                                                'lib/assets/images/label/select.png',
                                                fit: BoxFit.cover,
                                              ),
                                            )
                                          : GestureDetector(
                                              onTap: () => {
                                                setState(() {
                                                  _checkValue = 1;
                                                })
                                              },
                                              child: SizedBox(
                                                  width: 20,
                                                  height: 20,
                                                  child: Container(
                                                    decoration: BoxDecoration(
                                                      border: Border.all(
                                                        color: rgba(
                                                            221, 221, 221, 1),
                                                        width: 1,
                                                      ),
                                                      shape: BoxShape.circle,
                                                    ),
                                                  )),
                                            ),
                                    ],
                                  ),
                                ),
                                Container(
                                  height: 57,
                                  child: Row(
                                    mainAxisAlignment:
                                        MainAxisAlignment.spaceBetween,
                                    crossAxisAlignment:
                                        CrossAxisAlignment.center,
                                    children: [
                                      Container(
                                        child: Row(
                                          children: [
                                            SizedBox(
                                              width: 24,
                                              height: 24,
                                              child: Image.asset(
                                                'lib/assets/images/zhifubao_square.png',
                                                fit: BoxFit.cover,
                                              ),
                                            ),
                                            Padding(
                                              padding:
                                                  EdgeInsets.only(left: 11),
                                              child: Text(
                                                '支付宝',
                                                style: TextStyle(
                                                  color: rgba(68, 68, 68, 1),
                                                  fontSize: 15,
                                                ),
                                              ),
                                            ),
                                          ],
                                        ),
                                      ),
                                      _checkValue == 2
                                          ? SizedBox(
                                              width: 20,
                                              height: 20,
                                              child: Image.asset(
                                                'lib/assets/images/label/select.png',
                                                fit: BoxFit.cover,
                                              ),
                                            )
                                          : GestureDetector(
                                              onTap: () => {
                                                setState(() {
                                                  _checkValue = 2;
                                                })
                                              },
                                              child: SizedBox(
                                                  width: 20,
                                                  height: 20,
                                                  child: Container(
                                                    decoration: BoxDecoration(
                                                      border: Border.all(
                                                        color: rgba(
                                                            221, 221, 221, 1),
                                                        width: 1,
                                                      ),
                                                      shape: BoxShape.circle,
                                                    ),
                                                  )),
                                            ),
                                    ],
                                  ),
                                ),
                              ],
                            ),
                          )
                        ]),
                  ),
                ),
              ),
              Positioned(
                  child: Container(
                      width: G.screenWidth(),
                      padding: EdgeInsets.only(
                          top: 8, bottom: 14, left: 16, right: 16),
                      // color: Colors.red,
                      decoration: BoxDecoration(
                          color: Colors.white,
                          boxShadow: [
                            BoxShadow(
                                color: Colors.white10, offset: Offset(0, 10)),
                          ],
                          border: Border(
                              top: BorderSide(
                                  width: 1, color: rgba(235, 235, 235, 1)))),
                      child: Container(
                        // padding: EdgeInsets.only(bottom: 30),
                        child: Row(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: [
                            Row(
                              children: [
                                Text(
                                  '¥',
                                  style: TextStyle(
                                      color: rgba(222, 90, 2, 1), fontSize: 14),
                                ),
                                Text(
                                  '599',
                                  style: TextStyle(
                                      color: rgba(222, 90, 2, 1), fontSize: 22),
                                ),
                                Text(
                                  '.00',
                                  style: TextStyle(
                                      color: rgba(222, 90, 2, 1), fontSize: 14),
                                )
                              ],
                            ),
                            AButton.normal(
                                width: 220,
                                child: Row(
                                  mainAxisAlignment: MainAxisAlignment.center,
                                  children: [
                                    Padding(
                                      padding: const EdgeInsets.only(left: 10),
                                      child: Text('提交订单'),
                                    ),
                                  ],
                                ),
                                bgColor: rgba(42, 125, 250, 1),
                                type: 'primary',
                                onPressed: () {
                                  G.pushNamed('/serve_success');
                                }),
                          ],
                        ),
                      )),
                  bottom: 0)
            ],
          ),
        ),
      ),
    );
  }
}
